<?php if(isset($_POST['login']) AND isset($_POST['mot_de_passe']) AND $_POST['mot_de_passe'] != "")
	{
		include 'connect.php';
		
		$sql = "SELECT user_name FROM $table_name 
			  WHERE user_name='$_POST[login]'
			  AND password=md5('$_POST[mot_de_passe]')";      #19
		$result = mysql_query($sql,$db)
			  or die("Exécution requête 1 impossible");     #21
		$num = mysql_num_rows($result);
		if ( $num == 1 )
			 {
				$_SESSION['auth']="yes";                      #33
				$_SESSION['logname'] = $_POST['login'];   #34
				$sqladmin = "SELECT categ FROM $table_name 
			  WHERE user_name='$_POST[login]'";
			  $resultad = mysql_query($sqladmin,$db)
			  	or die("Exécution requête 1 impossible");
			  $categorie = mysql_fetch_array($resultad);
			  $_SESSION['categorie'] = $categorie[0];
				header("Location: ./index.php");
			 }

		else // Si le login ou mot de passe est incorrect
		{
			$messageerror = 'Mauvais login et/ou mot de passe';
		}
	}
	// Si il n'y a pas eu de validation du formulaire, on ne fait rien
	else {}
?>
<ul class="itemtitre">
			  <li><b><b><b>Identification</b></b></b></li></ul>
					<form id="identification" action="index.php" method="post" name="identification">
					<p><label for="login">Pseudo:</label><input id="login" type="text" name="login" size="12"/></p>
					<p><label for="password">Mot de passe :</label><input id="password" type="password" name="mot_de_passe" size="12"/></p>
					<input type="submit" name="validation" value="Validation"/>
					<br/>
					<p class="alert_error alert_error2"><?php

						if ( isset($messageerror) )
						{
							echo $messageerror;
						}

					?></p>
					<p class="ident_info"><a href="<?php echo $_GLOBALS['site_url']; ?>lost_password.php">Forgot your password ? </a>
					<br/> 
					<a href="<?php echo $_GLOBALS['site_url']; ?>register.php" >Register</a></p>
					</form>